test: make sure that allowed_room_ids is included in the /summary client-server API response for rooms with restricted join rules, as required by Matrix 1.15.#873
Conversation
client-server API response for rooms with restricted join rules, as required by Matrix 1.15.
5095fde to
63309ff
Compare
…response for rooms with restricted join rules, as required by Matrix 1.15. (#19762) Currently the `/summary` endpoint on the client and federation APIs does not include the allowed_room_ids field, that is present on the /hierarchy API. This is required by the 1.15 spec and this is what this PR does. Complement test: matrix-org/complement#873 Part of #18731
| t.Run("restricted room includes allowed_room_ids", func(t *testing.T) { | ||
| res := alice.MustDo(t, "GET", []string{"_matrix", "client", "v1", "room_summary", restrictedRoom}) | ||
| must.MatchResponse(t, res, match.HTTPResponse{ | ||
| StatusCode: 200, | ||
| JSON: []match.JSON{ | ||
| match.JSONKeyEqual("room_id", restrictedRoom), | ||
| match.JSONKeyEqual("join_rule", "restricted"), | ||
| match.JSONKeyEqual("allowed_room_ids", []interface{}{space}), | ||
| }, | ||
| }) | ||
| }) |
There was a problem hiding this comment.
Any tests for /room_summary can be flaky for workerized Synapse deployments because the /room_summary endpoint uses information from the room_stats_state table which is updated out-of-band as replication reaches the worker that handles background tasks. This is a read-after-write consistency issue in Synapse.
I created element-hq/synapse#19905 to track the flakiness for this specific test as we're seeing flaky failures where the join_rule is missing from the /room_summary response (room_stats_state hasn't been updated yet).
I'm commenting as these tests were specifically added to test a change to Synapse (element-hq/synapse#19762). I think this is more a problem with Synapse, not the test though. If we wanted to be extra nice on the test side, we could alice.MustSyncUntil(...) and wait until the room shows up with the expected state. As a note: this isn't bullet-proof either as the worker serving /sync could be different than the worker updating room_stats_state and handling /room_summary. I think it would probably solve the immediate pesky flakes though.
Test for element-hq/synapse#19762
Pull Request Checklist
Signed-off-by: Thomas Traineau t.traineau@famedly.com